package com.dianxin.smartpark.web.common;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.chinatelecom.response.common.CommonResponseBody;
import com.dianxin.smartpark.dao.qo.common.SmartParkAccessTimeQO;
import com.dianxin.smartpark.service.common.SmartParkAccessTimeService;
import com.dianxin.smartpark.service.vo.common.SmartParkAccessTimeVO;
import com.dianxin.sso.client.annotation.RecordLog;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 授权时间段管理
 * 
 * @author chenjiasong
 * @date 2021-07-28
 */
@RestController
@RequestMapping("/smartpark/time")
public class SmartParkAccessTimeController
{
    @Resource
    private SmartParkAccessTimeService smartParkAccessTimeService;

    /**
     * 查询授权时间段管理列表
     */
    @GetMapping("/list")
    @SaCheckPermission(value = "/smartpark/time/list")
    @RecordLog(name = "查询授权时间段管理列表")
    public CommonResponseBody<List<SmartParkAccessTimeVO>>  list(SmartParkAccessTimeQO qo)
    {
        return smartParkAccessTimeService.selectSmartParkAccessTimeList(qo);
    }


    /**
     * 获取授权时间段管理详细信息
     */
    @GetMapping(value = "/getInfo")
    @RecordLog(name = "获取授权时间段管理详细信息")
    @SaCheckPermission(value = "/smartpark/time/getInfo")
    public CommonResponseBody<SmartParkAccessTimeVO> getInfo(SmartParkAccessTimeQO qo)
    {
        return smartParkAccessTimeService.selectSmartParkAccessTime(qo);
    }

    /**
     * 新增授权时间段管理
     */
    @PostMapping("/add")
    @SaCheckPermission(value = "/smartpark/time/add")
    @RecordLog(name = "新增授权时间段管理")
    public  CommonResponseBody<Boolean> add(@RequestBody SmartParkAccessTimeVO vo)
    {
        return smartParkAccessTimeService.insertSmartParkAccessTime(vo);
    }

    /**
     * 修改授权时间段管理
     */
    @PutMapping("/edit")
    @SaCheckPermission(value = "/smartpark/time/edit")
    @RecordLog(name = "修改授权时间段管理")
    public  CommonResponseBody<Boolean> edit(@RequestBody SmartParkAccessTimeVO vo)
    {
        return smartParkAccessTimeService.updateSmartParkAccessTime(vo);
    }

    /**
     * 删除授权时间段管理
     */
	@DeleteMapping("/remove")
    @SaCheckPermission(value = "/smartpark/time/remove")
    @RecordLog(name = "删除授权时间段管理")
    public  CommonResponseBody<Boolean> remove(@RequestBody SmartParkAccessTimeVO vo)
    {
        return smartParkAccessTimeService.deleteSmartParkAccessTime(vo);
    }
}
